import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;

/**
 * Created by berkbozkurt on 07/03/15.
 */
public class HardBrick extends Rectangle implements Brick {

    private Point location;
    private int life;
    private Dimension size;

    public HardBrick() {
        super();
        location = new Point();
        life = 1;
        width = 40;
        height = 40;
    }

    @Override
    public void setLocation(int x, int y) {
        location.x = x;
        location.y = y;
    }
    @Override
    public Point getLocation() {
        return location;
    }
    @Override
    public BufferedImage getImage() {
        BufferedImage img = null;
        try {

            img = ImageIO.read(new File("resources/hardBrick.png"));
        }
        catch (IOException e) {
            System.out.println("Can't find img");
            e.printStackTrace();
        }
        return img;
    }
    @Override
    public Dimension getSize() {return size; }

    @Override
    public void setSize(Dimension size) {
        this.size = size;
    }
    @Override
    public void update() {

        setFrame(location.x,location.y,size.getWidth(), size.getHeight());
    }

    @Override
    public void decreaseLife() {
        life--;
    }
    @Override
    public int getLife() {
        return life;
    }

    @Override
    public void destroyBrick() {
        life = 0;
    }

}
